<?php

/**
 * LuxNews form base class.
 *
 * @method LuxNews getObject() Returns the current form's model object
 *
 * @package    Luxclub
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseLuxNewsForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'news_id'          => new sfWidgetFormInputHidden(),
      'news_title'       => new sfWidgetFormInputText(),
      'news_description' => new sfWidgetFormTextarea(),
      'news_content'     => new sfWidgetFormTextarea(),
      'newstype_id'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('LuxNewstype'), 'add_empty' => false)),
      'news_adduser'     => new sfWidgetFormInputText(),
      'news_active'      => new sfWidgetFormInputText(),
      'news_order'       => new sfWidgetFormInputText(),
      'news_createdate'  => new sfWidgetFormDateTime(),
      'news_updatedate'  => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'news_id'          => new sfValidatorChoice(array('choices' => array($this->getObject()->get('news_id')), 'empty_value' => $this->getObject()->get('news_id'), 'required' => false)),
      'news_title'       => new sfValidatorString(array('max_length' => 200)),
      'news_description' => new sfValidatorString(array('max_length' => 500)),
      'news_content'     => new sfValidatorString(),
      'newstype_id'      => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('LuxNewstype'))),
      'news_adduser'     => new sfValidatorInteger(),
      'news_active'      => new sfValidatorInteger(),
      'news_order'       => new sfValidatorInteger(),
      'news_createdate'  => new sfValidatorDateTime(),
      'news_updatedate'  => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('lux_news[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'LuxNews';
  }

}
